<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPEzp_nrm html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="${path}/statics/layui/css/layui.css">
		<link rel="stylesheet" type="text/css" href="${path}/statics/css/member/login/center.css">
	</head>
	<body>
		<div class="public_m1">
        	<div class="public_m2">资料管理</div>
            <!--照片和内容-->	
            <div class="">
            	<!--left-->
                <div class="zp_nrm_l">
                	<c:if test="${member.newFileName==null}">
                	<img src="${path}/statics/img/member/login/user.png">
                	</c:if>
                	<c:if test="${member.newFileName!=null}">
                	<img src="${serverPath}/memberImg/${member.newFileName}">
                	</c:if>
                </div>
                <!--right-->
                <div class="zp_nrm_r">
				<form action="" method="post" id="formId">
					<input type="hidden" name="id" value="${member.id}"/>
                	<p><em>昵称：</em><input name="nickName"  id="nickNAmeId" value="${member.nickName}"></p>
                    <p><em>性别.${member.sex}：</em><input type="radio" name="sex" value="男" id="sexId" class="sex_m" ${member.sex=='男'?'checked':''}><i>男</i>
                    	  <input type="radio" name="sex" value="女" id="sexId" class="sex_m" ${member.sex=='女'?'checked':''}><i>女</i></p>
                   <p><em>生日：</em><input type="text" name="birthday" id="birthdayId" value="<fmt:formatDate value="${member.birthday}" pattern="yyyy-MM-dd"/>" /></p>
                   <p><em>地址：</em><input name="address"  id="addressId" value="${member.address}"></p>
                    <button type="button" class="layui-btn" id="uploadId">
			  <i class="layui-icon">&#xe67c;</i>上传图片
			</button>
                    <a href="" class="public_m3" id="saveBtn">保存修改</a>
					
					</form>
                </div>
            </div>
        </div>
		
		
		<script src="${path}/statics/layui/layui.js"></script>
		<script>
		//JavaScript代码区域
		layui.use(['jquery','layer','upload'], function(){
		  var $ = layui.jquery;
		  var layer = layui.layer;
		  var upload = layui.upload;
		  
		  //执行实例
		  var uploadInst = upload.render({
		    elem: '#uploadId' //绑定元素
		    ,url: '${path}/memberCtl/toUploadImg' //上传接口
		    ,accept: 'images'
		    ,field: 'memberImg'
		    ,multiple: true
		    
		    
		    ,done: function(res){
		      //上传完毕回调
		      if(res==0){
		    	  layer.msg("上传成功",{icon:1});
		    	  location.reload();
		      }else{
		    	  layer.msg("上传失败",{icon:2});
		      }
		      
		      
		    }
		  
		 //   ,error: function(){
		      //请求异常回调
		    //}
		  });
		  
		  //点击查询按钮的处理事件
		  $("#saveBtn").click(function(){
			 
			 $.post("${path}/memberCtl/save", $("#formId").serialize(),function(res){
				 if(res == 0){
					 layer.msg("保存成功",{icon:1},function(){
						 location.reload("${path}/memberCtl/memberInfo");
					 })
				 }else{
					 layer.msg("保存失败,请稍后再试",{icon:1});
				 }
			 });
			 
			 
			  
		  });
		  
		});
		  
		
		</script>
	</body>
</html>
